import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import java.util.Iterator;
import java.io.*;
import java.util.Calendar;
import java.util.Date;

public class AF_Helper {

    public void ReadSheet() throws Exception {

        //String filename = "book1.xlsx";
        String filename = "test_files/DA.xlsx";
        FileInputStream fis = null;

        try {
            fis = new FileInputStream(filename);

            XSSFWorkbook workbook = new XSSFWorkbook(fis);
            XSSFSheet sheet = workbook.getSheetAt(0);
            Iterator rows = sheet.rowIterator();
            int number = sheet.getLastRowNum() + 1;
            System.out.println(" number of rows: " + number);
            while (rows.hasNext()) {

                XSSFRow row = ((XSSFRow) rows.next());
                Iterator cells = row.cellIterator();
                
                while (cells.hasNext()) {
                    XSSFCell cell = (XSSFCell) cells.next();
                    Date date;
                    
                    if(cell.getCellType() == 0){
                        date = cell.getDateCellValue();
                        System.out.println(date.toString());
                    } else {                    
                        String Value = cell.getStringCellValue();
                        if(Value.equals(""))
                            System.out.println(cell.getRowIndex() + ", " + cell.getColumnIndex());
                        else
                            System.out.println(Value);
                    }
                }
            }
        } catch (IOException e) {
            e.printStackTrace();

        } finally {
            if (fis != null) {
                fis.close();
            }
        }
    }

    public static void main(String[] args) {
        AF_Helper object = new AF_Helper();

        try {
            object.ReadSheet();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}




















/*
import org.apache.poi.hssf.*;


public class AF_Helper {

    public static void main(String[] args) {
        
       
    }
}
*/